#include <stdio.h>
#include <string.h>

#include "../rid_fn85.h"

int
main(int argc, char *argv[])
{
	Rid id1;
	Rid id2;
	Rid id3;
	Rid_fn85 str1;
	Rid_fn85 str2;
	size_t pos = 0;
	const char *error;

	/* set both id1 to a random value */
	rid_set(id1, NULL);

	/* copy id1 into id2 */
	rid_set(id2, id1);

	/* convert Rids to strings */
	rid_fn85(str1, id1);
	rid_fn85(str2, id2);

	/* and they will produce equal strings if they have the same value */
	if (!strcmp(str1, str2))
		printf("that only makes sense.\n");

	/* we can also get an Rid from a string */
	if (rid_fn85_parse(id3, str1, &pos, &error) == FN85_OKAY) {
		printf("%s\n", str1);
	} else {
		printf("%s at %zu\n", error, pos);
	}

	if (!rid_cmp(id3, id1))
		printf("this will also be printed!\n");

	/* and that's all there is to it! */
	return 0;
}
